package org.pupil.rpc.protocol.serialization;

import java.io.IOException;

/**
 * 序列化接口
 */
public interface RpcSerialization {

    /**
     * 序列化
     * @param obj
     * @param <T>
     * @return
     * @throws IOException
     */
    <T> byte[] serialize(T obj) throws IOException;


    /**
     * 反序列化
     * @param data
     * @param clazz
     * @param <T>
     * @return
     * @throws IOException
     */
    <T> T deSerialize(byte[] data, Class<T> clazz) throws IOException;
}
